﻿@using Abc.Core;
@using Abc.Application;
@model Abc.Core.DbDifferenceTableConfig;
@{
	ViewData["Title"] = "RSA";
}
<div class="layui-collapse" lay-filter="test">
	<div class="layui-colla-item">
		<h2 class="layui-colla-title">代码生成说明</h2>
		<div class="layui-colla-content">
			<p>1.未同时设置数据库类型和数据库连接字符串的情况下，使用系统当前配置文件中的第一个数据库</p>
			<p>2.数据库差异对比使用的是sqlsugar</p>
		</div>
	</div>

</div>
<section class="panel panel-padding">
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">

		<form class="layui-form" action="">
			<table class="layui-table">
				<tbody>
					<tr>
						<td>数据库类型</td>
						<td>
							<select asp-for="DbType" asp-items="Html.GetEnumSelectList<SqlSugar.DbType>()"></select>
						</td>

						<td>数据库连接字符串</td>
						<td>
							<textarea asp-for="DbConn" class="layui-textarea"></textarea>
						</td>
					</tr>

					<tr>
						<td>对比结果</td>
						<td colspan="3">
							<textarea class="lay-textarea" id="result"  style="height:200px;min-width:400px;"></textarea>
						</td>

					</tr>
					<tr>
						<td></td>
						<td>
							<div class="layui-btn submitbtn" lay-submit lay-filter="submit">保存并对比差异</div>
						</td>
					</tr>
				</tbody>
			</table>

		</form>
	</div>
</section>

@*<script src="~/lib/ckeditor4/ckeditor.js"></script>*@
@section Scripts{
	<script>
		layui.define(['element', 'jquery', 'form'], function () {
			let $ = layui.jquery;
			let form = layui.form;
			let element = layui.element;
			let dtree = layui.dtree;

			//Info 初始化
			abc.infoInit();
			//提交
			form.on('submit(submit)', function (obj) {
				abc.post({
					url: '@(Url.Action("DbDifferenceTables"))'
					, data: obj.field
					,done:function(result){
						if (result.Succeeded) {
							$("#result").val(result.Data);
						}
					}

				});

				return false;
			});


		});
	</script>
}
